package com.yumhai.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yumhai.system.mapper.FeedbackMapper;
import com.yumhai.system.service.FeedbackService;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.model.entity.sys.Feedback;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class FeedbackServiceImpl implements FeedbackService {

    @Resource
    private FeedbackMapper feedbackMapper;

    public IPage getFeedbackPagination(PaginationVo paginationVo) throws Exception {

        IPage page = new Page( paginationVo.getPageIndex(), paginationVo.getPageSize() );
        LambdaQueryWrapper<Feedback> lqs = new LambdaQueryWrapper<>();
        lqs.orderByDesc(Feedback::getCreateTime);
        feedbackMapper.selectPage(page, lqs);

        return page;
    }
}
